/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.brainstretch.jsf;

import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.*;
import org.brainstretch.ejb.managers.QuizManager;
import org.brainstretch.models.User;
import org.brainstretch.models.quizzes.Quiz;

/**
 *
 * @author mrodaitis
 */
@ManagedBean
@SessionScoped
public class HomeController implements Serializable{

    @EJB
    QuizManager quizManager;
           
    
    public List<Quiz> getRecentQuizzes(){
        return quizManager.mostRecent(10);
    }
    
    public String createSampleData(){
        User user = new User();
        user.setName("testUser");
        user.setPassword("password");
        quizManager.create(user);
        return null;
    }
}
